package net.ermannofranco.genericdaojdbc.clause;

import net.ermannofranco.genericdaojdbc.dao.GenericDao;
import net.ermannofranco.genericdaojdbc.util.Comparation;
import net.ermannofranco.genericdaojdbc.util.NullEnum;

public abstract class Clause {

	public abstract Clause[] getInnerClauses();

	public static ComparationClause equal(String propName, Object value) {
		return new ComparationClause(propName, value);
	}

	public static ComparationClause gt(String propName, Object value) {
		return new ComparationClause(propName, Comparation.GREATER_THAN, value);
	}

	public static ComparationClause gtOrEq(String propName, Object value) {
		return new ComparationClause(propName, Comparation.GREATER_OR_EQ, value);
	}

	public static ComparationClause ltOrEq(String propName, Object value) {
		return new ComparationClause(propName, Comparation.LESS_OR_EQ, value);
	}

	public static ComparationClause lt(String propName, Object value) {
		return new ComparationClause(propName, Comparation.LESS_THAN, value);
	}

	public static ComparationClause like(String propName, Object value) {
		return new ComparationClause(propName, Comparation.LIKE, value);
	}

	public static ComparationClause notEqual(String propName, Object value) {
		return new ComparationClause(propName, Comparation.NOT_EQUAL, value);
	}

	public static ComparationClause notLike(String propName, Object value) {
		return new ComparationClause(propName, Comparation.NOT_LIKE, value);
	}

	public static NullityClause isNotNull(String propName) {
		return new NullityClause(propName, NullEnum.IS_NOT_NULL);
	}

	public static NullityClause isNull(String propName) {
		return new NullityClause(propName, NullEnum.IS_NULL);
	}

	public static HavingClause having(Comparation c, Object value) {
		return new HavingClause(c, value);
	}

	public static MultiClause and(Clause... clauses) {
		return new MultiClause(GenericDao.AND, clauses);
	}

	public static MultiClause or(Clause... clauses) {
		return new MultiClause(GenericDao.OR, clauses);
	}
}
